package com.xinxing.learning.datasource.controller;

import com.xinxing.learning.datasource.model.DynamicDataSourceModel;
import com.xinxing.learning.datasource.service.DynamicDataSourceService;
import com.xinxing.learning.datasource.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/datasource")
public class DynamicDataSourceController {

    @Autowired
    private DynamicDataSourceService dynamicDataSourceService;

    /**
     * 查询全部
     */
    @GetMapping("/listall")
    public ResponseResult listAll() {
        List<DynamicDataSourceModel> result = dynamicDataSourceService.listAll();
        return ResponseResult.success(result);
    }
}
